package com.aca.impl;

import com.aca.dao.AdminDAO;
import com.aca.entity.Admin;
import com.aca.service.AdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
@Service("adminService")
public class AdminServiceImpl implements AdminService {
    @Autowired
    private AdminDAO adminDao;

    public void setAdminDao(AdminDAO adminDao) {
        this.adminDao = adminDao;
    }

    @Override
    public void regAdmin(Admin admin) {
        adminDao.regAdmin(admin);
    }

    @Override
    public void delAdmin(Admin admin) {
        adminDao.delAdmin(admin);
    }

    @Override
    public void delAdmin(String userName) {
        adminDao.delAdmin(userName);
    }

    @Override
    public Admin findAdminByName(String name, boolean isUsername) {
        return adminDao.findAdminByName(name,isUsername);
    }

    @Override
    public Admin findAdminByUserName(String userName) {
        return adminDao.findAdminByUserName(userName);
    }

    @Override
    public Admin findAdminByNickName(String nickName) {
        return adminDao.findAdminByUserName(nickName);
    }

    @Override
    public List pageAdmin(int pageCur, int pageSize, Admin admin) {
        return adminDao.pageAdmin(pageCur,pageSize,admin);
    }

    @Override
    public int getAdminTol() {
        return adminDao.getAdminTol();
    }

    @Override
    public List findAllAdmin() {
        return adminDao.findAllAdmin();
    }

    @Override
    public boolean existAdmin(String name, boolean isUsername) {
        return adminDao.existAdmin(name,isUsername);
    }

    @Override
    public boolean existAdminByUserName(String userName) {
        return adminDao.existAdminByUserName(userName);
    }

    @Override
    public boolean existAdminByNickName(String nickName) {
        return adminDao.existAdminByNickName(nickName);
    }

    @Override
    public Admin checkAdmin(String username, String password) {
        return adminDao.checkAdmin(username,password);
    }
}
